fix(peer_connection): implement SCTP/DataChannel close on PeerConnection shutdown#76
Open
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Open
fix(peer_connection): implement SCTP/DataChannel close on PeerConnection shutdown#76nightness wants to merge 1 commit intowebrtc-rs:masterfrom
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Conversation
…ion shutdown SctpHandler::close() and DataChannelHandler::close() both returned Ok(()) without actually closing anything. On PeerConnection close, SCTP associations were left in a running state and data channels were never transitioned to Closed. - SctpHandler::close(): close all SCTP associations with LocallyClosed reason, then clear the associations map and drop the endpoint. - DataChannelHandler::close(): close each RTCDataChannelInternal instance (sets ready_state → Closed, closes underlying data channel stream), then clear the data channels map. - handler/mod.rs: remove stale async-era TODO comment block that cannot compile in this synchronous sans-IO handler; replace with a comment documenting which handler handles which W3C close step. ICE, DTLS, and interceptor close were already correctly implemented in their respective handlers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d7d5a8b to
58c9cf4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SctpHandler::close(): was a no-op (Ok(())). Now iterates all SCTP associations, callsassoc.close(AssociationError::LocallyClosed)on each, clears the associations map, and drops the endpoint.DataChannelHandler::close(): was a no-op. Now callsdc.close()on eachRTCDataChannelInternal(transitions state toClosed, closes the underlying SCTP stream), then clears the data channels map.handler/mod.rs: removes the stale ~40-line async-era/* TODO: */comment block that used.awaitsyntax incompatible with this synchronous sans-IO handler. Replaced with a concise comment mapping each W3C close step to the handler that implements it.ICE (
IceHandler::close()→agent.close()), DTLS (DtlsHandler::close()→dtls_transport.stop()), and interceptor (InterceptorHandler::close()→interceptor.close()) were already correctly implemented.Test plan
cargo test -p rtc— all 246 tests passClosedstate and no SCTP timers remain running🤖 Generated with Claude Code